package com.fy56.platform.logistics.utils;


import java.util.Date;

public class FormNoUtil {
	/**
	 * 根单号规则生成单号
	 * @param type
	 * @return
	 */
	public static String querySetNumber(String type){
		//单号规则 企业编码(JT)+模块编号(合同单HTD)+时间(YYYYMMDDhhmmssmss)
		//企业编码
		String companyNo = "JT";
		//时间编码
		Date date = new Date();
		String numberNo = companyNo;//企业编码
		numberNo +=getModelType(type);
		numberNo += DateUtil.turnDateToString(date, "yyyyMMddHHmmssSSS");
		System.out.println(type +" ：生成单号"+DateUtil.turnDateToString(new Date(),"yyyy-MM-dd HH:mm:ss")+"，单号:"+numberNo);
		return numberNo;
	}
	public static String getModelType(String modelType) {
		String typeT = "";
		if(modelType.equals("contract")){
			typeT="HTD";
		}else if(modelType.equals("execute")){
			typeT="ZXD";
		}else if(modelType.equals("gasCardRecharge")){
			typeT="GCR";
		}else if(modelType.equals("gasCardFinance")){
			typeT="GCF";
		}else if(modelType.equals("sendcar")){
			typeT="PCD";
		}else if(modelType.equals("sendcarBorrow")){
			typeT="JKD";
		}else if(modelType.equals("creditCardRecharge")){
			typeT="CCR";
		}else if(modelType.equals("journalAccount")){
			typeT="LSZ";
		}else if(modelType.equals("gasCardConsume")){
			typeT="GCC";
		}else if(modelType.equals("creditCardConsume")){
			typeT="CCC";
		}else if(modelType.equals("carRepairs")){
			typeT="CRS";
		}else if(modelType.equals("paymentApplyInfo")){
			typeT="BYJ";
		}else if(modelType.equals("reportAccount")){
			typeT="BZD";
		}else if(modelType.equals("reconciliation")){
			typeT="REC";
		}else if(modelType.equals("purchaseOrder")){
			typeT ="CGD";
		}else if(modelType.equals("tyreCheck")){
			typeT ="LT";
		}
		return typeT;
	}
}
